import { addNameSpace } from './util'

const NAME_SPACE = 'WHITE_LIST'

const addPrefix = addNameSpace(NAME_SPACE)

// 设置号码
export const SET_PHONE = addPrefix('SET_PHONE')

// 设置开始时间
export const SET_START_TIME = addPrefix('SET_START_TIME')

// 设置结束时间
export const SET_END_TIME = addPrefix('SET_END_TIME')

// 获取数据
export const GET_DATA = addPrefix('GET_DATA')

// 获取数据成功
export const GET_DATA_SUCCESS = addPrefix('GET_DATA_SUCCESS')

// 获取数据失败
export const GET_DATA_FAIL = addPrefix('GET_DATA_FAIL')

// 设置page num
export const SET_PAGE_NUM = addPrefix('SET_PAGE_NUM')

// 显示添加弹框
export const SHOW_ADD_MODAL = addPrefix('SHOW_ADD_MODAL')

// 隐藏添加弹框
export const HIDDEN_ADD_MODAL = addPrefix('HIDDEN_ADD_MODAL')

// 设置添加号码
export const SET_ADD_PHONE = addPrefix('SET_ADD_PHONE')

// 添加数据
export const ADD_DATA = addPrefix('ADD_DATA')

// 添加数据成功
export const ADD_DATA_SUCCESS = addPrefix('ADD_DATA_SUCCESS')

// 添加数据失败
export const ADD_DATA_FAIL = addPrefix('ADD_DATA_FAIL')

// 删除数据
export const DELETE_DATA = addPrefix('DELETE_DATA')

// 删除数据成功
export const DELETE_DATA_SUCCESS = addPrefix('DELETE_DATA_SUCCESS')

// 删除数据失败
export const DELETE_DATA_FAIL = addPrefix('DELETE_DATA_FAIL')

export const setPhone = (phone) => ({ type: SET_PHONE, phone })

export const setStartTime = (startTime) => ({ type: SET_START_TIME, startTime })

export const setEndTime = (endTime) => ({ type: SET_END_TIME, endTime })

export const getData = () => ({ type: GET_DATA })

export const getDataSuccess = (data) => ({ type: GET_DATA_SUCCESS, data })

export const getDataFail = () => ({ type: GET_DATA_FAIL })

export const setPageNum = (pageNum) => ({ type: SET_PAGE_NUM, pageNum })

export const showAddModal = () => ({ type: SHOW_ADD_MODAL })

export const hiddenAddModal = () => ({ type: HIDDEN_ADD_MODAL })

export const setAddPhone = (addPhone) => ({ type: SET_ADD_PHONE, addPhone })

export const addData = () => ({ type: ADD_DATA })

export const addDataSuccess = () => ({ type: ADD_DATA_SUCCESS })

export const addDataFail = () => ({ type: ADD_DATA_FAIL })

export const deleteData = (data) => ({ type: DELETE_DATA, data })

export const deleteDataSuccess = () => ({ type: DELETE_DATA_SUCCESS })

export const deleteDataFail = () => ({ type: DELETE_DATA_FAIL })

export default {
  setPhone,
  setStartTime,
  setEndTime,
  getData,
  getDataSuccess,
  getDataFail,
  setPageNum,
  showAddModal,
  hiddenAddModal,
  setAddPhone,
  addData,
  addDataSuccess,
  addDataFail,
  deleteData, 
  deleteDataSuccess,
  deleteDataFail,
}